Skip to content

ReactiveProperty class

Attributes: [DataContract] [DebuggerDisplay("{IsDisposed}, {Value}")]

Defined in

Namespace: ReactiveUI.Reactive Assembly: ReactiveUI.Reactive.dll Full name: ReactiveUI.Reactive.ReactiveProperty<T> Modifiers: public

Summary

View source

        Represents a reactive property that notifies subscribers of value changes and supports asynchronous validation and
        error notification.
        

Applies to

net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471

Class hierarchy
classDiagram
class ReactiveProperty~T~
class ReactiveObject
ReactiveObject <|-- ReactiveProperty~T~
class IReactiveProperty~T~ {
    <>
}
IReactiveProperty~T~ <|.. ReactiveProperty~T~
class IObservable~T?~ {
    <>
}
IObservable~T?~ <|.. ReactiveProperty~T~
class IsDisposed {
    <>
}
IsDisposed <|.. ReactiveProperty~T~
class IDisposable {
    <>
}
IDisposable <|.. ReactiveProperty~T~
class INotifyDataErrorInfo {
    <>
}
INotifyDataErrorInfo <|.. ReactiveProperty~T~
class INotifyPropertyChanged {
    <>
}
INotifyPropertyChanged <|.. ReactiveProperty~T~

Inherits from: ReactiveObject

Implements: IReactiveProperty, IObservable, IsDisposed, IDisposable, INotifyDataErrorInfo, INotifyPropertyChanged

Remarks

ReactiveProperty provides observable value semantics, allowing consumers to subscribe to value changes and validation error updates. It supports INotifyPropertyChanged and INotifyDataErrorInfo for integration with data binding scenarios. Validation logic can be attached to perform asynchronous or synchronous checks, and error notifications are propagated to observers. Thread safety and scheduling of notifications are managed via the provided scheduler. Disposing the instance releases all resources and completes all observable streams.

Constructors

NameSummary
.ctorInitializes a new instance of the [ReactiveProperty](# class with the default value, using the task pool scheduler and default notification and distinctness...

Properties

NameSummary
IsDisposedGets a value indicating whether gets a value that indicates whether the object is disposed.
ValueGets or sets the current value of the container.
HasErrorsGets a value indicating whether any errors are currently present.
ObserveErrorChangedGets an observable sequence that signals when the collection of validation errors changes.
ObserveHasErrorsGets an observable sequence that signals whether the object currently has validation errors.

Methods

NameSummary
static CreateCreates a new instance of ReactiveProperty without requiring RequiresUnreferencedCode attributes. Uses RxSchedulers.TaskpoolScheduler as the default scheduler.
AddValidationErrorAdds a validation rule to the current ReactiveProperty instance using the specified validator function.
DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
CheckValidationTriggers the validation check for the current value.
RefreshRefreshes the current value and notifies subscribers of any changes.
GetErrorsGets the validation errors for the specified property or for the entire object.
SubscribeSubscribes the specified observer to receive notifications from this observable sequence.

Events

NameSummary
ErrorsChanged
Inherited members